﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DatabaseAccessLayer;
namespace WebApplication
{
    public partial class Offers_Posted : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Header.InnerHtml = string.Concat("<b>Country: </b>", Request["co"], " &nbsp; &nbsp; <b>City:</b> ", Request["c"] == "City" ? "All City" : Request["c"]);
                CountryService service = new CountryService();
                List<string> property = service.GetProperty();
                ddlProperty.DataSource = property;
                ddlProperty.DataBind();
                ddlProperty.Items.Insert(0, "Select Property");
                ddlProperty.Items.Insert(1, "All");
                if (Session["UserID"].ToString() != "Guest")
                {

                    ((System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("divbreadcrum")).InnerHtml = @"<a href='Menu.aspx'>Home</a> >  <a href='menu.aspx'>Menu</a> > <a href='real_estate_search.aspx'>Real Estate Search</a> >  <a href='javascript:void();' onclick='history.go(-1);'>Real Estate Search Menu</a> > <span>Offers Posted</span> ";
                }
                else
                {
                    ((System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("divbreadcrum")).InnerHtml = @"<a href='default.aspx'>Home</a> >  <a href='menu.aspx'>Menu</a> > <a href='real_estate_search.aspx'>Real Estate Search</a> >  <a href='javascript:void();' onclick='history.go(-1);'>Real Estate Search Menu</a> > <span>Offers Posted</span> ";
                }
            }

        }
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            if (ddlProperty.SelectedItem.Text == "All")
            {
                Response.Redirect("Offers_Posted_Results.aspx?co=" + Request["co"] + "&c=" + Request["c"] + "&P=All&PT=All&Mode=" + ddlBuyerType.SelectedItem.Text);
            }
            else
            {
                Response.Redirect("Offers_Posted_Results.aspx?co=" + Request["co"] + "&c=" + Request["c"] + "&P=" + Request.Form.GetValues("ctl00$MainContent$ddlProperty")[0] + "&PT=" + Request.Form.GetValues("ctl00$MainContent$ddlPropertyType")[0] + "&Mode=" + ddlBuyerType.SelectedItem.Text);
            }
        }
    }
}